﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.Customers>" %>
<%@ Import Namespace="CRM.Database.Model" %>
<%@ Import Namespace="CRM.Resourses" %>


<% using (Html.BeginForm("Edit","Customers"))
   {
       Html.ValidationSummary(true);

       Html.DevExpress().Button(
    settings =>
    {
        settings.Name = "btnUpdate";
        settings.ControlStyle.CssClass = "button";
        settings.Text = Resourses.Save;
        settings.UseSubmitBehavior = true;
    }
    ).GetHtml(); 
       
       %>
<table class="СustomerProfile">
        <tr>
            <td style="text-align: right;">
             
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <th>
                            <%:Resourses.customerCustomerNumber%>
                        </th>
                        <td>
                            <%: Html.DevExpress().TextBox( settings =>
                                                      {
                                                          settings.Name = "SequentialNumber";
                                                          settings.ReadOnly = true;

                                                      }).Bind(Model.SequentialNumber).GetHtml() %>
                        </td>
                        <th>
                            <%:Resourses.customerSAPnumber%>
                        </th>
                        <td>
                            <%: Html.DevExpress().TextBox( settings =>
                                                      {
                                                          settings.Name = "NumberInSAP";
                                                          

                                                      }).Bind(Model.NumberInSAP).GetHtml()%>
                        </td>
                    </tr>
                     <tr>
                        <th>
                            <%:Resourses.customerCustomerName%>
                        </th>
                        <td>
                            <%: Html.DevExpress().TextBox( settings =>
                                                      {
                                                          settings.Name = "Name";
                                                         

                                                      }).Bind(Model.Name).GetHtml()%>
                        </td>
                        <th>
                            <%:Resourses.customerByDelegation%>
                        </th>
                        <td>
                            <%var col = new CustomerClassificationsProfineCollection();%><%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsProfine";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsProfine";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                          

                                                      }).BindList(col.CustomerClassificationsProfineList).Bind(Model.IdCustomerClassificationsProfine).GetHtml()%> 
                        </td>
                    </tr>
                  <tr>
                        <th>
                            <%:Resourses.customerManager%>
                        </th>
                        <td><% var col1 = new UsersCollection(); %>
                           <%: Html.DevExpress().ComboBox(settings=>
                                                      {
                                                          settings.Name = "IdManager";

                                                          settings.Properties.TextField = "LocalizedFullName";
                                                          settings.Properties.ValueField = "IdUser";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                                                      }).BindList(col1.UsersList).Bind(Model.IdManager).GetHtml()%> 
                        </td>
                        <th>
                            <%:Resourses.customerByBuisiness%>
                        </th>
                        <td><% var col2 = new CustomerClassificationsByBusinessCollection(); %>
                            <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsByBusiness";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsByBusiness";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col2.CustomerClassificationsByBusinessList).Bind(Model.IdCustomerClassificationsByBusiness).GetHtml()%>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <%:Resourses.customerRegion%>
                        </th>
                        <td>
                         <% var col3 = new profineRegionsCollection(); %>   <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdprofineRegion";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdprofineRegion";
                                                        //  settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                         // settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col3.profineRegionsList).Bind(Model.IdprofineRegion).GetHtml()%> 
                        </td>
                        <th>
                            <%:Resourses.customerByTurnover%>
                        </th>
                       <td>
                         <% var col4 = new CustomerClassificationsTurnoverCollection(); %>   <%: Html.DevExpress().ComboBox(settings =>
                                                      {
                                                          settings.Name = "IdCustomerClassificationsTurnover";
                                                          settings.Properties.ValueType = typeof(int);
                                                          settings.Properties.TextField = "LocalizedName";
                                                          settings.Properties.ValueField = "IdCustomerClassificationsTurnover";
                                                          settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                                                          settings.Properties.DropDownStyle = DropDownStyle.DropDownList;

                                                      }).BindList(col4.CustomerClassificationsTurnoverList).Bind(Model.IdCustomerClassificationsTurnover).GetHtml()%> 
                        </td>
                    </tr>
                      <tr>
                        <th>
                            <%:Resourses.customerStartWorking%>
                        </th>
                        <td>
                                        <%: Html.DevExpress().DateEdit(
                            settings => {
                                settings.Name = "DateStartProfineRUS";
                                settings.Properties.DisplayFormatString = "Y";
                                           
                            }
                        ).Bind(Model.DateStartProfineRUS).GetHtml() %>
                        </td>
                        <th>
                            <%:Resourses.IsActive%>
                        </th>
                                               
                        <td id="checkbox">
                                    <%:Html.DevExpress().CheckBox(
                            settings => {
                                settings.Name = "IsActive";
                                            settings.ReadOnly = true;
                                            // if (Model.IsActive != true) settings.Checked = false; else settings.Checked = true;
                            }
                                                                ).Bind(Model.IsActive).GetHtml()%>   
                        </td>

                    </tr>  
                </table>
            </td>
        </tr>
           <%--<tr>
            <td>
                <table >
                    <tr>
                        <th><%:Resourses.customerSalesDistribution%></th>
                        <td>
                            <%Html.RenderAction("GetDistributionChanels", "Customers",Model); %>
                        </td>
                        <td>График</td>
                    </tr>
                    <tr>
                        <th><%:Resourses.customerProductProtfolio%></th>
                        <td>
                            <% Html.RenderAction("GetGeneral_ProductPortfolio", "Customers", Model); %>
                        </td><td>График</td>
                    </tr>
                </table>    
            </td>
        </tr>--%>
       
    </table>

  <%  }
    %>